From: Florian Müllner Date: Thu, 23 May 2024 22:07:11 +0000 (+0200) Subject: ci: Use `meson introspect` to generate artifact path X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~263^2^2~7 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=0cf3d513c7834c8981709643f5d6e765175ce686;p=gnome-shell.git ci: Use `meson introspect` to generate artifact path We currently assume that the `CI_COMMIT_TAG` variable matches the version component of the generated dist tarball. That is usually correct, but sometimes errors happen and a wrong tag is pushed, and the real release uses something like "46.0-real". Account for that by building the artifact path from `meson introspect` and exporting it as environment variable. Part-of: (cherry picked from commit 27445a1c98a463bcb826edae9850972c3616b90c) --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 64c290ee9..44bb138f9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -263,6 +263,23 @@ flatpak: nightly: extends: '.publish_nightly' +distinfo: + stage: deploy + needs: + - build + script: + - .gitlab-ci/export-artifact-path build > dist.env + artifacts: + reports: + dotenv: dist.env + paths: + - build + - mutter + - subprojects/jasmine-gjs + - dist.env + rules: + - if: '$CI_COMMIT_TAG' + dist: variables: XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir" @@ -281,13 +298,16 @@ dist: - "**/meson.build" - meson/* - dist-tarball: extends: dist + needs: + - distinfo artifacts: expose_as: 'Get tarball here' paths: - - build/meson-dist/$CI_PROJECT_NAME-$CI_COMMIT_TAG.tar.xz + - $TARBALL_ARTIFACT_PATH + reports: + dotenv: dist.env rules: - if: '$CI_COMMIT_TAG' diff --git a/.gitlab-ci/export-artifact-path b/.gitlab-ci/export-artifact-path new file mode 100755 index 000000000..f9a7534fd --- /dev/null +++ b/.gitlab-ci/export-artifact-path @@ -0,0 +1,21 @@ +#!/usr/bin/gjs -m +// SPDX-FileCopyrightText: 2024 Florian Müllner +// +// SPDX-License-Identifier: GPL-2.0-or-later + +import Gio from 'gi://Gio'; +import {programArgs, programInvocationName, exit} from 'system'; + +const [buildDir] = programArgs; +if (!buildDir) { + printerr(`usage: ${programInvocationName} `); + exit(1); +} + +const subprocess = Gio.Subprocess.new( + ['meson', 'introspect', '--projectinfo', buildDir], + Gio.SubprocessFlags.STDOUT_PIPE); +const [, out] = subprocess.communicate_utf8(null, null); + +const {descriptive_name, version} = JSON.parse(out); +print(`TARBALL_ARTIFACT_PATH=${buildDir}/meson-dist/${descriptive_name}-${version}.tar.xz`);